package com.ele.web;

import com.ele.pojo.Business;
import com.ele.service.BusinessService;
import com.ele.service.impl.BusinessServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/businessRegist")
public class BusinessRegistServlet extends HttpServlet {
    private BusinessService businessService = new BusinessServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String account = req.getParameter("account");
        String password = req.getParameter("password");
        String telephone = req.getParameter("telephone");
        String contact = req.getParameter("contact");

        Business business = new Business();
        business.setAccount(account);
        business.setPassword(password);
        business.setTelephone(telephone);
        business.setContact(contact);
        Integer x = this.businessService.BusinessRegister(business);
        resp.getWriter().write(x+"");
    }
}
